home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_perl.idb / usr / freeware / catman / p_man / cat3 / Math::BigInt.Z / Math::BigInt
Encoding:
Text File  |  1998-10-28  |  3.6 KB  |  133 lines

  1.  
  2.  
  3.  
  4.      MMMMaaaatttthhhh::::::::BBBBiiiiggggIIIInnnntttt((((3333)))) 22225555////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))  MMMMaaaatttthhhh::::::::BBBBiiiiggggIIIInnnntttt((((3333))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.       Math::BigInt - Arbitrary size    integer    math package
  10.  
  11.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.         use    Math::BigInt;
  13.         $i = Math::BigInt->new($string);
  14.  
  15.         $i->bneg return BINT           negation
  16.         $i->babs return BINT           absolute    value
  17.         $i->bcmp(BINT) return CODE           compare numbers (undef,<0,=0,>0)
  18.         $i->badd(BINT) return BINT           addition
  19.         $i->bsub(BINT) return BINT           subtraction
  20.         $i->bmul(BINT) return BINT           multiplication
  21.         $i->bdiv(BINT) return (BINT,BINT)  division    (quo,rem) just quo if scalar
  22.         $i->bmod(BINT) return BINT           modulus
  23.         $i->bgcd(BINT) return BINT           greatest    common divisor
  24.         $i->bnorm return BINT           normalization
  25.  
  26.  
  27.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  28.       All basic math operations are    overloaded if you declare your
  29.       big integers as
  30.  
  31.         $i = new Math::BigInt '123 456 789 123 456 789';
  32.  
  33.  
  34.       Canonical notation
  35.         Big    integer    value are strings of the form /^[+-]\d+$/ with
  36.         leading zeros suppressed.
  37.  
  38.       Input
  39.         Input values to these routines may be strings of the form
  40.         /^\s*[+-]?[\d\s]+$/.
  41.  
  42.       Output
  43.         Output values always always    in canonical form
  44.  
  45.       Actual math is done in an internal format consisting of an
  46.       array    whose first element is the sign    (/^[+-]$/) and whose
  47.       remaining elements are base 100000 digits with the least
  48.       significant digit first.  The    string 'NaN' is    used to
  49.       represent the    result when input arguments are    not numbers,
  50.       as well as the result    of dividing by zero.
  51.  
  52.      EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  53.          '+0'                 canonical zero value
  54.          '     -123 123 123'             canonical value '-123123123'
  55.          '1    23 456 7890'             canonical value '+1234567890'
  56.  
  57.  
  58.      AAAAuuuuttttooooccccrrrreeeeaaaattttiiiinnnngggg ccccoooonnnnssssttttaaaannnnttttssss
  59.       After    use Math::BigInt ':constant' all the integer decimal
  60.  
  61.  
  62.  
  63.      Page 1                        (printed 10/23/98)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      MMMMaaaatttthhhh::::::::BBBBiiiiggggIIIInnnntttt((((3333)))) 22225555////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))  MMMMaaaatttthhhh::::::::BBBBiiiiggggIIIInnnntttt((((3333))))
  71.  
  72.  
  73.  
  74.       constants in the given scope are converted to    Math::BigInt.
  75.       This conversion happens at compile time.
  76.  
  77.       In particular
  78.  
  79.         perl -MMath::BigInt=:constant -e 'print 2**100'
  80.  
  81.       print    the integer value of 2**100.  Note that    without
  82.       convertion of    constants the expression 2**100    will be
  83.       calculatted as floating point    number.
  84.  
  85.      BBBBUUUUGGGGSSSS
  86.       The current version of this module is    a preliminary version
  87.       of the real thing that is currently (as of perl5.002)    under
  88.       development.
  89.  
  90.      AAAAUUUUTTTTHHHHOOOORRRR
  91.       Mark Biggar, overloaded interface by Ilya Zakharevich.
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.      Page 2                        (printed 10/23/98)
  130.  
  131.  
  132.  
  133.